from multiprocessing import  Process


def test1():
    while 1:
        print('Hello, world')


def test2(n):
    print(n)


if __name__ == '__main__':
    p1 = Process(target=test1)
    p1.daemon = True    # 设置p1为守护进程
    p1.start()
    for i in range(3):
        p2 = Process(target=test2, args=(i, ))
        p2.start()
    print('===============')        # 主进程代码执行结束，守护进程结束